{% extends "bills/base.html" %}
{% block body_main %}
<table border="0">
<tr>
<td valign="top">
<table border="1">
<caption>  Bill: </caption>
<tbody>
 <tr> <th> # </th> <td> {{ object.pk }} </td> </tr>
 <tr> <th> Объект </th> <td> {{ object.project }} </td> </tr>
 <tr> <th> Направление </th> <td> {{ object.depart }} </td> </tr>
 <tr> <th> Поставщик </th> <td> {{ object.supplier }} </td> </tr>
 <tr> <th> Ответственный </th> <td> {{ object.assign }} </td> </tr>
 <tr> <th> Подписант </th> <td> {{ object.approve }} </td> </tr>
 <tr> <th> Состояние </th> <td>
  {% if object.isalive %}
   {% if object.isgood %} В пути {% else %} Черновик {% endif %}
  {% else %}
   {% if object.isgood %} Согласован {% else %} Не согласован {% endif %}
  {% endif %}
 </td> </tr>
 <tr> <th> Маршрут </th> <td>
  <ol>
  {% for i in object.route.all %}
   <li> {{ i }} </li>
  {% endfor %}
  </ol>
 </td> </tr>
 <tr>
  <td> Оригинал: </td>
  <td>
   <p> <a href="{% url bills.views.bill_get object.pk %}"> <img src="{{ STATIC_URL }}img/{{icon}}"/> {{ object.name }} </a> (Страниц: {{ object.pages }}) </p>
   <p>
    <ul class="enlarge">
    {% for i in pagelist %}
     <li>
      <img src="{{ STATIC_URL }}cache/{{object.get_filename}}-{{i|add:"1"}}.png" width="64px" alt="Page {{i|add:"1"}}" />
      <span>
       <img src="{{ STATIC_URL }}cache/{{object.get_filename}}-{{i|add:"1"}}.png" alt="Page {{i}}" /> <br />
       Page 1
      </span>
     </li>
    {% endfor %}
    </ul>
   </p>
  </td>
 </tr>
 </tbody>
</table>
</td>
<td valign="top">
<table border="1">
<caption> История: </caption>
<thead>
 <th> Когда </th>
 <th> Кто </th>
 <th> Камменты </th>
</thead>
<tbody>
  {% for i in object.billevent_set.all %}
  <tr>
   <td valign="top"> {{i.ctime|date:"y.m.d H:i:d" }} </td>
   <td valign="top"> {{ i.user }} </td>
   <td valign="top"> <pre> {{ i.comment }} </pre> </td>
  </tr>
  {% endfor %}
</tbody>
</table>
</td>
</tr>
</table>
<p>
{% if canedit %} <a href="{% url bills.views.bill_edit object.pk %}"> <button type="button"> Edit </button> </a> {% endif %}
{% if candel %} <a href="{% url bills.views.bill_delete object.pk %}"> <button type="button"> Delete </button> </a> {% endif %}
</p>
{% if canaccept %}
<form action="" method="POST">
	{% csrf_token %}
	{{ form.as_p }}
<p>
<button type="submit" name="resume" value="accept"> OK </button>
{% if canreject %} <button type="submit" name="resume" value="reject"> Отказать </button> {% endif %}
</p>
</form>
{% endif %}
{% if err %} <p> Error: {{ err }} </p> {% endif %}
{% endblock %}
